﻿using GetSlaughterItem.API.Application.Commands.Week01.Addrs;
using GetSlaughterItem.API.Application.Commands.Week01.Manageres;
using GetSlaughterItem.API.Application.Commands.Week02.BasicSettings;
using GetSlaughterItem.API.Application.Commands.Week02.LiveAnimalsa;
using GetSlaughterItem.API.Application.Commands.Week03.leos;
using GetSlaughterItem.API.Application.Commands.Week03.wenk;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SlaughterItem.Common.Dtos;

namespace GetSlaughterItem.API.Controllers.Leo
{
    /// <summary>
    /// leo
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class WeekListOne_Leo : ControllerBase
    {

        private readonly IMediator mediator;
        private readonly ILogger<WeekListOne_Leo> logger;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mediator"></param>
        public WeekListOne_Leo(IMediator mediator,ILogger<WeekListOne_Leo> logger)
        {
            this.mediator = mediator;
            this.logger = logger;
        }


        /// <summary>
        /// 市
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetCitys(CitysSuretenComend cmd)
        {
            try
            {
                logger.LogInformation("市下拉成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("市下拉失败");
                throw;
            }
           
        }

        /// <summary>
        /// 区
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetAreas(AreasSuretenComend cmd)
        {
            try
            {
                logger.LogInformation("区下拉成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("区下拉失败");
                throw;
            }
            
        }

        /// <summary>
        /// 行业标签表
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetIndustrytags(IndustrytagsSuretenCommend cmd)
        {
            try
            {
                logger.LogInformation("行业标签表下拉成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("行业标签表下拉失败");
                throw;
            }
            
        }

        /// <summary>
        /// 客户管理列表
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> GetClientsShow()
        {
            try
            {
                logger.LogInformation("客户管理列表显示成功");
                return await mediator.Send(new ClientsSuretenCommend());
            }
            catch (Exception)
            {
                logger.LogError("客户管理列表失败");
                throw;
            }
            
        }

        /// <summary>
        /// 磅秤类型列表
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> GetScaleTypeShow()
        {
            try
            {
                logger.LogInformation("磅秤类型列表显示成功");
                return await mediator.Send(new ScaleTypeSuretenCommend());
            }
            catch (Exception)
            {
                logger.LogError("磅秤类型列表显示失败");
                throw;
            }
            
        }

        /// <summary>
        /// 商品代号
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> GetUPCDataShow()
        {
            try
            {
                logger.LogInformation("商品代号下拉成功");
                return await mediator.Send(new UPCDataSuretenCommend());
            }
            catch (Exception)
            {
                logger.LogError("商品代号下拉失败");
                throw;
            }
           
        }

        /// <summary>
        /// 待宰圈管理列表
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetSlaughteredShow(SlaughteredSuretenCommend cmd)
        {
            try
            {
                logger.LogInformation("待宰圈管理列表显示成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("待宰圈管理列表显示失败");
                throw;
            }
           
        }

        /// <summary>
        /// 待宰圈管理反填
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetSlaughteredMang(SlaughteredManageCommend cmd)
        {
            try
            {
                logger.LogInformation("待宰圈管理反填成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("待宰圈管理反填失败");
                throw;
            }
           
        }

        /// <summary>
        /// 皮重列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetTareShow(TareSuretenCommend cmd)
        {
            try
            {
                logger.LogInformation("皮重列表显示成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("皮重列表显示失败");
                throw;
            }
           
        }

        /// <summary>
        /// 分割领用列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> GetSplitRequisShow()
        {
            try
            {
                logger.LogInformation("分割领用列表显示成功");
                return await mediator.Send(new SplitRequisSuretenCommend());
            }
            catch (Exception)
            {
                logger.LogError("分割领用列表显示失败");
                throw;
            }
            
        }

        /// <summary>
        /// 商品批号列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> GetProductShow()
        {
            try
            {
                logger.LogInformation("商品批号列表下拉成功");
                return await mediator.Send(new ProductSuretenCommend());
            }
            catch (Exception)
            {
                logger.LogError("商品批号列表下拉失败");
                throw;
            }
            
        }

        /// <summary>
        /// 分割领用反填
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetSplitRequisMang(SplitRequisManageCommend cmd)
        {
            try
            {
                logger.LogInformation("分割领用反填成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("分割领用反填失败");
                throw;
            }
           
        }

        /// <summary>
        /// 待宰圈号
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> GeWaitingShow()
        {
            try
            {
                logger.LogInformation("待宰圈号显示成功");
                return await mediator.Send(new WaitingQueryCommand());
            }
            catch (Exception)
            {
                logger.LogError("待宰圈号显示失败");
                throw;
            }
            
        }

        /// <summary>
        /// 活畜
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> GeLiveAnimalsShow2()
        {
            try
            {
                logger.LogInformation("活畜列表显示成功");
                return await mediator.Send(new LiveAnimalsShow2Command());
            }
            catch (Exception)
            {
                logger.LogError("活畜列表显示失败");
                throw;
            }
            
        }

        /// <summary>
        /// 销售称重列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GeSaleShow(SaleSuretenCommend cmd)
        {
            try
            {
                logger.LogInformation("销售称重列表显示成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("销售称重列表显示失败");
                throw;
            }
            
        }

        /// <summary>
        /// 销售明细列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GeSaleDetaishow(SaleDetaisSuretenCommend cmd)
        {
            try
            {
                logger.LogInformation("销售明细列表显示成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("销售明细列表显示失败");
                throw;
            }
            
        }

        /// <summary>
        /// 销售明细反填
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GeSaleDetaiMang(SaleMangeCommend cmd)
        {
            try
            {
                logger.LogInformation("销售明细反填成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("销售明细反填失败");
                throw;
            }
            
        }

        /// <summary>
        /// 销售明细列表2
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> GeSaleDetaishow2()
        {
            try
            {
                logger.LogInformation("销售明细列表2显示成功");
                return await mediator.Send(new SaleDetaisSuretenCommend2());
            }
            catch (Exception)
            {
                logger.LogError("销售明细列表2显示失败");
                throw;
            }
            
        }

        /// <summary>
        /// 膘油称重表列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GeOilyfatShow(OilyfatScrentenCommend cmd)
        {
            try
            {
                logger.LogInformation("膘油称重表列表显示成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("膘油称重表列表显示失败");
                throw;
            }
            
        }

        /// <summary>
        /// 划膘生成列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GeOScratchesShow(ScratchesScrentenCommend cmd)
        {
            try
            {
                logger.LogInformation("划膘生成列表显示成功");
                return await mediator.Send(cmd);
            }
            catch (Exception)
            {
                logger.LogError("划膘生成列表显示失败");
                throw;
            }
            
        }


        /// <summary>
        /// 制单人
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> GetMake()
        {
            try
            {
                logger.LogInformation("制单人下拉成功");
                return await mediator.Send(new MakeScrentenCommend());
            }
            catch (Exception)
            {
                logger.LogError("制单人下拉失败"); 
                throw;
            }
            
        }

        /// <summary>
        /// 班组
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> GetProduction()
        {
            try
            {
                logger.LogInformation("班组下拉成功");
                return await mediator.Send(new ProductionScrentenCommend());
            }
            catch (Exception)
            {
                logger.LogError("班组下拉失败");
                throw;
            }
            
        }

        /// <summary>
        /// 销售汇总
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> GetSalesSummary()
        {
            try
            {
                logger.LogInformation("销售汇总成功");
                return await mediator.Send(new SalesSummarySuretenCommend());
            }
            catch (Exception)
            {
                logger.LogError("销售汇总失败");
                throw;
            }

        }
    }    
    
}
